Get started

    API Endpoint

        http://IP-Address
        Result example :

        {
            "endpoint": "ready"
        }        
            

Endpoint IP Address

In Order to use WiFi Lan based API interface of Orvai devices (Plug and Power Strip), user must know the IP address of plug.

Orvai devices use DHCP to obtain IP address from router. It is recommended that you do MAC address binding in router so that router assign same IP address every time smart plug sends dhcp request to router.
You can watch video How to find MAC Address and assign fixed IP to Orvai devices

API Key

You can protect API access from unauthorized sources by using API Key. API Key is set to optional by default. User can set it to mandatory to protect from unauthorized access.

Please note if API Key is set to mandatory, you need to provide API Key in each request. If API Key is missing in request or does not match with the stored key, it will be considered a unauthorized attempt. A Maximum of 20 unauthorized attempts are allowed. Exceeding the max attempts will block access to device You will need physical access of device to reset apikey. You can watch video How to reset API Key on blocked device to factory default. The default api key set from factory is 1234567890987654321

Please make sure that if you make API Key mandatory, you remember it or note it down at some safe and secure place.

Following are 2 APIs exception to above rule that does not require API Key even if API Key is mandatory.

  • GET APIKEY HINT
  • GET APIKEY FLAG

GET STATUS


# Here is a curl example
curl -X GET "http://192.168.1.3/getstatus?swid=1&apikey=1234567890987654321"
                

This API is used to fetch the current status of a switch/plug on Orvai device. You need to make HTTP GET call to the following url :
http://IP-Address/getstatus



Result example :

{
    "result": "success",
    "status": 1
}
                

INPUT PARAMETERS (Format: Query String)

Field Type Description
apikey string Your API key
swid integer In case of multiswitch device, this parameter specify the switch id for which api need to be invoked.
For single switch device like smart plug this parameter is optional
Valid Values
[1] Smart Plug (Optional)
[1,2,3,4,5] Smart Power Strip

OUTPUT PARAMETERS (Format: Json)

Field Type Description
result string success/error
status integer This parameter is returned in case of success.
0 - Siwtch-Off
1 - Switch-On

SET STATUS


# Here is a curl example
curl -X GET "http://192.168.1.3/setstatus?swid=1&status=0&apikey=1234567890987654321"
                

This API is used to change the current status of a switch/plug on Orvai device. You need to make HTTP GET call to the following url :
http://IP-Address/setstatus



Result example :

{
    "result": "success"
}
                

INPUT PARAMETERS (Format: Query String)

Field Type Description
apikey string Your API key
swid integer In case of multiswitch device, this parameter specify the switch id for which api need to be invoked.
For single switch device like smart plug this parameter is optional
Valid Values
[1] Smart Plug (Optional)
[1,2,3,4,5] Smart Power Strip
status integer Status of the switch
Valid Values [0, 1]
0 - Siwtch-Off
1 - Switch-On

OUTPUT PARAMETERS (Format: Json)

Field Type Description
result string success/error

ADD SCHEDULE


# Here is a curl example
curl -X GET "http://192.168.1.3/addschedule?apikey=1234567890987654321&swid=2&hour=1&min=5&event=0&enabled=1&repeat=0&sun=0&mon=0&tue=0&wed=1&thu=0&fri=0&sat=0"
                

This API is used to add a schedule to specified switch/socket. Please note that non-repeatble schedules will be disabled automatically once executed and will remain in memory as disabled schedules. You need to make HTTP GET call to the following url :
http://IP-Address/addschedule



Result example :

{
    "result": "success",
}
                

INPUT PARAMETERS (Format: Query String)

Field Type Description
apikey string Your current API key
swid integer In case of multiswitch device, this parameter specify the switch id for which api need to be invoked.
For single switch device like smart plug this parameter is optional
Valid Values
[1] Smart Plug (Optional)
[1,2,3,4,5] Smart Power Strip
hour integer clock hour in 24 hour format. More than one schedule with same hour and minute combination are not allowed
Valid Values [0 - 23]
min integer clock minutes. More than one schedule with same hour and minute combination are not allowed
Valid Values [0 - 59]
event integer On/Off Event at scheduled time
Valid Values [0, 1]
0 - Siwtch-Off
1 - Switch-On
enabled integer Enabling/Disabling schedule
Valid Values [0, 1]
0 - Disabled
1 - Enabled
repeat integer Make schedule repeatable on different days of a week
Valid Values [0, 1]
0 - Disabled
1 - Enabled
sun integer Make schedule repeatable on Sunday
Valid Values [0, 1]
0 - Disabled
1 - Enabled
mon integer Make schedule repeatable on Monday
Valid Values [0, 1]
0 - Disabled
1 - Enabled
tue integer Make schedule repeatable on Tuesday
Valid Values [0, 1]
0 - Disabled
1 - Enabled
wed integer Make schedule repeatable on Wednesday
Valid Values [0, 1]
0 - Disabled
1 - Enabled
thu integer Make schedule repeatable on Thursday
Valid Values [0, 1]
0 - Disabled
1 - Enabled
fri integer Make schedule repeatable on Friday
Valid Values [0, 1]
0 - Disabled
1 - Enabled
sat integer Make schedule repeatable on Saturday
Valid Values [0, 1]
0 - Disabled
1 - Enabled

OUTPUT PARAMETERS (Format: Json)

Field Type Description
result string success/error

GET SCHEDULE


# Here is a curl example
curl -X GET "http://192.168.1.3/getschedule?apikey=1234567890987654321&swid=1"
                

This API is used to fetch schedules on specific switch/socket. You need to make HTTP GET call to the following url :
http://IP-Address/getschedule



Result example :

{
    "result": "success",
    "schedules": [
        {
            "swid": 1,
            "hour": 16,
            "min": 15,
            "event": 0,
            "enabled": 1,
            "repeat": 1,
            "sun": 1,
            "mon": 0,
            "tue": 1,
            "wed": 0,
            "thu": 1,
            "fri": 1,
            "sat": 0
        },
        {
            "swid": 1,
            "hour": 18,
            "min": 15,
            "event": 0,
            "enabled": 1,
            "repeat": 1,
            "sun": 1,
            "mon": 0,
            "tue": 1,
            "wed": 0,
            "thu": 1,
            "fri": 1,
            "sat": 0
        }
    ]
}

                

INPUT PARAMETERS (Format: Query String)

Field Type Description
apikey string Your current API key
swid integer In case of multiswitch device, this parameter specify the switch id for which api need to be invoked.
For single switch device like smart plug this parameter is optional
Valid Values
[1] Smart Plug (Optional)
[1,2,3,4,5] Smart Power Strip

OUTPUT PARAMETERS (Format: Json)

Field Type Description
result string success/error
schedules Array {
"swid": INTEGER,
"hour": INTEGER,
"min": INTEGER,
"event": INTEGER,
"enabled": INTEGER,
"repeat": INTEGER,
"sun": INTEGER,
"mon": INTEGER,
"tue": INTEGER,
"wed": INTEGER,
"thu": INTEGER,
"fri": INTEGER,
"sat": INTEGER
}

DELETE SCHEDULE


# Here is a curl example
curl -X GET "http://192.168.1.3/deleteschedule?apikey=1234567890987654321&hour=1&min=5"
                

This API is used to delete a schedule based on scheduled time. You need to make HTTP GET call to the following url :
http://IP-Address/deleteschedule



Result example :

{
    "result": "success",
}
                

INPUT PARAMETERS (Format: Query String)

Field Type Description
apikey string Your current API key
hour integer clock hour in 24 hour format
Valid Values [0 - 23]
min integer clock minutes
Valid Values [0 - 59]

OUTPUT PARAMETERS (Format: Json)

Field Type Description
result string success/error

DELETE ALL SCHEDULE


# Here is a curl example
curl -X GET "http://192.168.1.3/deleteallschedule?apikey=1234567890987654321"
                

This API is used to delete all the schedules on device. You need to make HTTP GET call to the following url :
http://IP-Address/deleteallschedule



Result example :

{
    "result": "success",
}
                

INPUT PARAMETERS (Format: Query String)

Field Type Description
apikey string Your current API key

OUTPUT PARAMETERS (Format: Json)

Field Type Description
result string success/error

SET CLOCK


# Here is a curl example
curl -X GET "http://192.168.1.3/setclock?apikey=1234567890987654321&c_day=4&c_hour=21&c_min=30&c_month=2&c_mday=12&c_sec=18"
                

This API is used to set clock on Orvai device (for schedules). After power reset device synchronizes its clock through internet. If internet is not available, then you need to set clock every time post power reset for successful schedule execution. This API can also help to synch time for any drift from actual time. You need to make HTTP GET call to the following url :
http://IP-Address/setclock



Result example :

{
    "result": "success",
}
                

INPUT PARAMETERS (Format: Query String)

Field Type Description
apikey string Your current API key
c_day integer Day of a Week
Valid Values [0 - 6]
0 - Sunday
1 - Monday
2 - Tuesday
3 - Wednesday
4 - Thursday
5 - Friday
6 - Saturday
c_hour integer Current Hour of the day. 24 hour clock
Valid Values [0 - 23]
c_min integer Current Minute
Valid Values [0 - 59]
c_sec integer Current Seconds
Valid Values [0 - 59]
c_mon integer Current Month of the Year
Valid Values [1 - 12]
c_mday integer Current Day of Month
Valid Values [1 - 31]

OUTPUT PARAMETERS (Format: Json)

Field Type Description
result string success/error

GET CLOCK


# Here is a curl example
curl -X GET "http://192.168.1.3/getclock?apikey=1234567890987654321"
                

This API is used to get current clock setting on the device. You need to make HTTP GET call to the following url :
http://IP-Address/getclock



Result example :

{
    "result": "success",
    "c_day": 4,
    "c_hour": 21,
    "c_min": 12,
    "c_sec": 12,
    "c_month": 1,
    "c_mday": 21
}

                

INPUT PARAMETERS (Format: Query String)

Field Type Description
apikey string Your current API key

OUTPUT PARAMETERS (Format: Json)

Field Type Description
result string success/error
c_day integer Day of the week
0 - Sunday
1 - Monday
2 - Tuesday
3 - Wednesday
4 - Thursday
5 - Friday
6 - Saturday
c_hour integer Current Hour of the day. 24 hour clock
Values [0 - 23]
c_min integer Current Minute
Values [0 - 59]
c_sec integer Current Seconds
Values [0 - 59]
c_mon integer Current Month of the Year
Values [1 - 12]
c_mday integer Current Day of Month
Values [1 - 31]

GET POWER-UP STATE


# Here is a curl example
curl -X GET "http://192.168.1.3/getpowerupstate?apikey=1234567890987654321&swid=1"
                

This API is used to get behaviour of switch/socket on Power Cut/Resume. You need to make HTTP GET call to the following url :
http://IP-Address/getpowerupstate



Result example :

{
    "result": "success",
    "powerupstate": 2
}

                

INPUT PARAMETERS (Format: Query String)

Field Type Description
apikey string Your current API key
swid integer In case of multiswitch device, this parameter specify the switch id for which api need to be invoked.
For single switch device like smart plug this parameter is optional
Valid Values
[1] Smart Plug (Optional)
[1,2,3,4,5] Smart Power Strip

OUTPUT PARAMETERS (Format: Json)

Field Type Description
result string success/error
integer powerupstate
0 - Always Off
1 - Always On
2 - Restore

SET POWER-UP STATE


# Here is a curl example
curl -X GET "http://192.168.1.3/setpowerupstate?apikey=1234567890987654321&swid=1&powerupstate=2"
                

This API is used to set the behaviour of switch/socket on Power Cut/Resume. By default it is set to restore that means if you light was on before power cut device will restore it to ON on power resume. You can change the behavious using this api . You need to make HTTP GET call to the following url :
http://IP-Address/setpowerupstate



Result example :

{
    "result": "success",
}
                

INPUT PARAMETERS (Format: Query String)

Field Type Description
apikey string Your current API key
swid integer In case of multiswitch device, this parameter specify the switch id for which api need to be invoked.
For single switch device like smart plug this parameter is optional
Valid Values
[1] Smart Plug (Optional)
[1,2,3,4,5] Smart Power Strip
powerupstate integer State on Power Recycle
Valid Values [0, 1, 2]
0 - Always Off
1 - Always-On
2 - Restore

OUTPUT PARAMETERS (Format: Json)

Field Type Description
result string success/error

GET APIKEY FLAG


# Here is a curl example
curl -X GET "http://192.168.1.3/getkeyflag"
                

This API is used to know if the API Key is mandatory or optional. You need to make HTTP GET call to the following url :
http://IP-Address/getkeyflag



Result example :

{
    "result": "success",
    "keyflag": 0
}
                

INPUT PARAMETERS (Format: None)

No Input Parameeter is required

OUTPUT PARAMETERS (Format: Json)

Field Type Description
result string success/error
keyflag integer This parameter is returned in case of success.
0 - Optional
1 - Mandatory

SET APIKEY FLAG


# Here is a curl example
curl -X GET "http://192.168.1.3/setkeyflag?keyflag=0&apikey=1234567890987654321"
                

This API is used to make API Key mandatory or optional. You need to make HTTP GET call to the following url :
http://IP-Address/setkeyflag



Result example :

{
    "result": "success",
}
                

INPUT PARAMETERS (Format: Query String)

Field Type Description
apikey string Your API key. This parameter is always mandatory
keyflag integer Keyflag Value
Valid Values [0, 1]
0 - Optional
1 - Mandatory

OUTPUT PARAMETERS (Format: Json)

Field Type Description
result string success/error
keyflag integer This parameter is returned in case of success.
0 - Optional
1 - Mandatory

GET APIKEY HINT


# Here is a curl example
curl -X GET "http://192.168.1.3/setstatus?swid=1&status=0&apikey=1234567890"
                

This API is used to provide only a hint to Api Key in which initial 2 and last 2 characters are displayed. There is no API to fetch full Key. In case genuine user forgets the key, this is the only option to get hint. In case brute force is used to find the key device access will be blocked forever after 20 attemps. This Api may be removed in furture upgrades. You need to make HTTP GET call to the following url :
http://IP-Address/getapikeyhint



Result example :

{
    "result": "success",
    "apikeyhint": "12xxxxxxxxxxxxxxx21"
}
                

INPUT PARAMETERS (Format: None)

No Input Parameeter is required

OUTPUT PARAMETERS (Format: Json)

Field Type Description
result string success/error
apikeyhint string This parameter is returned in case of success

SET APIKEY


# Here is a curl example
curl -X GET "http://192.168.1.3/setapikey?apikey=1234567890987654321&new_apikey=123456789987654321"
                

This API is used to change the current API Key. You need to make HTTP GET call to the following url :
http://IP-Address/setapikey



Result example :

{
    "result": "success",
}
                

INPUT PARAMETERS (Format: Query String)

Field Type Description
apikey string Your current API key. This parameter is always mandatory
new_apikey string Your New API key

OUTPUT PARAMETERS (Format: Json)

Field Type Description
result string success/error